//
//  meterView.m
//  CommandCenter08
//
//  Created by Matt Roman on 7/18/08.
//  Copyright 2008 University of Oklahoma. All rights reserved.
//

#import "meterView.h"


@implementation meterView

- (id)initLevelViewWithFrame:(NSRect)frameRect andRover:(roverProperties *)rp
{
	NSPoint	origin;
	origin.x = 190;
	origin.y = 0;
	self = [super initWithFrame:frameRect];
	[self setFrameOrigin:origin];
	[self setFrameRotation:90];
	[self setNeedsDisplay:YES];
	[voltageText setFrameRotation:270];
	[electCurrentText setFrameRotation:270];
	[panelCurrentText setFrameRotation:270];
	[motorCurrentText setFrameRotation:270];
	
	voltage = &rp->voltage;
	electCurrent = &rp->electronicsCurrent;
	panelCurrent = &rp->panelCurrent;
	motorCurrent = &rp->motorCurrent;
	return self;
}


- (void)updateMeterView
{
	[voltageText setFloatValue:*voltage/100.0];
	[electCurrentText setFloatValue:*electCurrent/1000];
	[panelCurrentText setFloatValue:*panelCurrent/1000];
	[motorCurrentText setFloatValue:*motorCurrent/1000];
	
	[voltageLevel setFloatValue:*voltage/100.0];
	[electronicsCurrentLevel setFloatValue:*electCurrent/1000];
	[panelCurrentLevel setFloatValue:*panelCurrent/1000];
	[motorCurrentLevel setFloatValue:*motorCurrent/1000];
	
	[self setNeedsDisplay:YES];
}
@end
